# print(1111)
#
#
# def bb():
#     print(22)

import datetime
# now_time = datetime.datetime.now()
# minute_time = datetime.datetime.now().minute
# certain_minute = [i * 5 + 1 for i in range(12)] + [i * 5 + 2 for i in range(12)] + [i * 5 + 3 for i in range(12)]
# print(now_time)
# print(minute_time)
# print(certain_minute)
#
# certain_minute.sort()
# print(certain_minute)
#
# assign_time = datetime.datetime.now().replace(second=0).strftime("%Y-%m-%d %H:%M:%S")
# print(assign_time)




# lists = [1,4,232,123,634,21,12]
# print(lists.sort())
# transformer_parm = [1,2,3,4,5,6,7,8,9,10,11,12]
# # transformer_parm = [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150]
# line = int(len(transformer_parm) / 3)
# for channel in range(line):
#     # print(channel)
#     print(transformer_parm[channel * 3])
#     # print(channel + 1)
import pymysql
import pandas as pd
import warnings

# 忽略警告信息
warnings.filterwarnings('ignore')

def a():
    con_user = pymysql.connect(host='10.16.9.29', port=3306, user="oetsky", password='Oetsky@123', db='cvt_client_prod',
                                   charset='utf8')

    df_recovered = pd.read_sql("SELECT * FROM inspection_event_info WHERE exception_id is NOT NULL;", con_user)
    df_not_recovered = pd.read_sql(
        "SELECT * FROM inspection_event_info WHERE exception_id is NULL and id NOT IN (SELECT DISTINCT exception_id FROM inspection_event_info WHERE exception_id IS NOT NULL);",
        con_user)
    con_user.close()
    return df_recovered, df_not_recovered

df_recovered, df_not_recovered = a()
# print(df_recovered)
# print("--------------")
print(df_not_recovered)
print("----")
print(df_not_recovered["event_name"])
print("----")
print(df_not_recovered["event_name"] == "电流频率异常")
print("----")
df_1 = df_not_recovered[(df_not_recovered["event_name"] == "电流频率异常")]
df_2 = df_recovered[(df_recovered["event_name"] == "电流频率异常")]


print(df_1)
# print(df_2)
#
# assert len(df_1) == 0
# assert len(df_2) == 0


